﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GoodMan.Infrastructure.Entities.Repository;

namespace GoodMan.Infrastructure.Entities.Entity
{
    public class Dormitory : IAccessible<T_Dormitory, Dormitory>, ILogicEntity<T_Dormitory, Dormitory>
    {
        #region 
        public int Id { get; set; }
        public string Name { get; set; }
        public int CollegeId { get; set; }
        public string Creator { get; set; }
        public DateTime CreateDate { get; set; }
        #endregion 

        public List<RebateReport> RebateReportList { get; set; }

        public List<User> Staff { get; set; }
        public Dormitory LoadStaff(List<User> user)
        {
            this.Staff = user;
            return this;
        }

    
        protected override void Covariant(T_Dormitory model)
        {
            if (model != null)
            {
                this.CollegeId = model.CollegeId;
                this.CreateDate = model.CreateDate;
                this.Creator = model.Creator;
                this.Id = model.Id;
                this.Name = model.Name;
            }
        }

        protected override T_Dormitory Inverter(Dormitory model)
        {
            if (model != null)
            {
                return new T_Dormitory()
                {
                    CollegeId = model.CollegeId,
                    CreateDate = model.CreateDate,
                    Creator = model.Creator,
                    Id = model.Id,
                    Name = model.Name
                };
            }
            return null;
        }

        public Dormitory Set(T_Dormitory dbModel)
        {
            Covariant(dbModel);
            return this;
        }
    }
}
